<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/page/public/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>线索库</title>
<%
	request.setAttribute("menu", 1);
%>
<%@ include file="/WEB-INF/page/public/contentmeta.jsp"%>
<script type="text/javascript" src="<%=basePath%>js/insert.js?v=8"></script>
<script type="text/javascript" src="<%=basePath%>js/qualify/zizhisel.js"></script>
<script type="text/javascript" src="<%=basePath%>js/jobsel/job.js"></script>
<link rel="stylesheet" href="<%=basePath%>css/global.css" media="all" />
<link rel="stylesheet"
	href="<%=basePath%>plugins/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="<%=basePath%>css/tab.css" media="all" />

<style type="text/css">
.layui-form-label i {
	color: red;
	padding-right: 3px;
}
.htlayui-disabled, .htlayui-disabled:hover {
    color: black;
    background-color:#e4e4e4;
    cursor: not-allowed;
}
</style>

</head>
<body>

	<input type="hidden" id="successlog" value="${successlog}">
	<input type="hidden" value="${customertype}" id="customertype">

	<div class="admin-tab TM-tab">
		<div class="layui-tab layui-tab-card">
			<%@ include file="/WEB-INF/page/customermanage/customerlistmenu.jsp"%>
			<div class="layui-tab-content">
				<div class="layui-tab-item layui-show">
					<div class="tab-condition">

						<%@ include
							file="/WEB-INF/page/customermanage/customerlistform.jsp"%>

						<div class="TM-tab-info">
							<a class="layui-btn layui-btn-primary layui-btn-small  insertbtn" typedata="${customertype}" statedata="${customerstate}"><i class="layui-icon">&#xe62f;</i>导入资源</a>
							<!-- <a class="layui-btn layui-btn-primary layui-btn-small  tjxqbtn"><i class="layui-icon">&#xe654;</i>添加需求</a>
							<a class="layui-btn layui-btn-primary layui-btn-small  sqhtbtn"  data="1"><i class="layui-icon">&#xe621;</i>申请合同</a>  -->
							<a class="layui-btn layui-btn-primary layui-btn-small  hdcxbtn"><i class="layui-icon">&#xe615;</i>检索录入</a> 
							<a class="layui-btn layui-btn-primary layui-btn-small yysjbtn"><i class="layui-icon">&#xe654;</i>添加预约</a> 
							<a class="layui-btn layui-btn-primary layui-btn-small fqbtn"><i class="layui-icon">&#x1006;</i>批量放弃</a> 
							<a class="layui-btn layui-btn-primary layui-btn-small  refreshbtn"><i class="layui-icon">&#x1002;</i>刷新</a>
						</div>
					</div>
					<div class="layui-field-box">
						<table class="site-table table-hover TM-table3">
							<thead>
								<tr>
									<th style="width: 5%;"><input type="checkbox"
										id="selected-all" name="customcheck" /></th>
									<th style="width: 25%;">企业名称</th>
									<th style="width: 10%;">企业资质</th>
									<th style="width: 8%;">所在地区</th>
									<th style="width: 8%;">联系人</th>
									<th style="width: 10%;">联系方式</th>
									<th style="width: 10%;">最后跟进时间</th>
									<th style="width: 10%;">成熟等级</th>
									<th style="width: 14%;">操作</th>
								</tr>
							</thead>
							<tbody>
								<c:set var="vEnter" value="\n" scope="request" />
								<%
									request.setAttribute("vEnter", "\n");
								%>
								<c:forEach var="obj" items="${pager.resultList}" varStatus="o1">
									<tr
										class="<c:if test="${obj.dystate == 0}">blue</c:if><c:if test="${obj.dystate == 2}">yellow</c:if><c:if test="${obj.dystate == 3}">red</c:if>">
										<td><input type="checkbox" name="customcheckbox"
											value="${obj.id}" data="${obj.dystate}" dname="${obj.cname}" /></td>
										<td> 
										  <c:if test="${obj.boutique !=null && obj.boutique==1}">
										    [<span style="color:#007eff">精</span>]
										  </c:if>
										  <c:if test="${obj.xzuser !=null && obj.xzuser.length()>0}">
										    [<span style="color:#007eff">协作</span>]
										  </c:if><dic:str value="${obj.cname}" maxLength="20" />
										
										</td>
										<td class="TM_hover seecategory seecategory${obj.id}"
											catevalue='<c:if test="${fn:length(obj.zzleval) > 0 }"><c:out value="${fn:replace(obj.zzleval, vEnter, '<br />')}" /> </c:if>'
											data="${obj.id}">
											<!-- 有一个显示一个，有多个显示一个并加...，没有就显示暂无资质信息 --> <c:if
												test="${fn:length(obj.zzleval)<1}">
											暂无资质情况
										</c:if> <c:if test="${fn:length(obj.zzleval)>1}">
												<dic:str value="${obj.zzleval}" maxLength="6" />
											</c:if>
										</td>
										<td><dic:str value="${obj.address}" maxLength="6" /></td>
										<td  id="dhlxr"><c:set property="mainuser" value="0" var="mainuser"></c:set><c:set property="mainusername" value="" var="mainusername"></c:set><c:if test="${fn:length(obj.contactsItem)> 0}"><c:set property="mainusername" 	value="${obj.contactsItem.get(0).name }" var="mainusername"></c:set><c:forEach items="${obj.contactsItem}" var="csObj"><c:if test="${csObj.ismain==1}">${csObj.name}<c:set property="mainuser" value="1" var="mainuser"></c:set></c:if></c:forEach></c:if><c:if test="${mainuser==0}">${mainusername}</c:if></td>
										<td><c:set property="mainuser" value="0" var="mainuser"></c:set>
											<c:if test="${fn:length(obj.contactsItem)> 0}">
												<c:forEach items="${obj.contactsItem}" var="csObj">
													<c:if test="${csObj.ismain==1}">${csObj.phone}<c:set
															property="mainuser" value="1" var="mainuser"></c:set>
													</c:if>
												</c:forEach>
												<c:if test="${mainuser==0}">${obj.contactsItem.get(0).phone}</c:if>
											</c:if></td>
										<td class="TM_hover seenote seenote${obj.id}" data="${obj.id}">${obj.updatedate.substring(0,10)}</td>
										<td><dic:cf value="${obj.state}" name="customer_state"
												type="1" /></td>
										<td data="${obj.id}">
											<button type="button"
												class="layui-btn layui-btn-normal layui-btn-mini xgbtn"
												data="${obj.id}">管理</button>
											<button type="button"
												class="layui-btn layui-btn-normal layui-btn-mini fqbtn1"
												data="${obj.id}">放弃</button>
											<button type="button"
												class="layui-btn layui-btn-normal layui-btn-mini lxjlbtn"
												data="${obj.id}">跟进</button>
										<c:if test="${sessionScope.user.id==1}">
											<button type="button"
												class="layui-btn layui-btn-normal layui-btn-mini hszbtn "
												data="${obj.id}">删除</button>
										</c:if>
										</td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
						<ul class="clefix differ">
							<li class="contact1"><input type="checkbox"
								class="lx_checkbox1" id="yyck1" data="2" /><span><label
									for="yyck1">已联系</label></span></li>
							<li class="contact3"><input type="checkbox"
								class="lx_checkbox1" id="yyck4" data="3" /><span><label
									for="yyck4">紧急联系</label></span></li>
							<li class="contact2"><input type="checkbox"
								class="lx_checkbox1" id="yyck2" data="0" /><span><label
									for="yyck2">已预约</label></span></li>
							<li><input type="checkbox" class="lx_checkbox1" data="99"
								id="yyck3" /><span><label for="yyck3">待预约</label></span></li>
						</ul>
						<div class="admin-table-page">
							<div class="page">
								<div class="layui-laypage">
									<span class="layui-laypage-total"><button type="button"
											class="layui-laypage-btn">共${pager.totalSize}条记录</button></span>
								</div>
							</div>
						</div>
						<div class="admin-table-page">
							<div id="page" class="page"></div>
						</div>

					</div>
				</div>
			</div>
		</div>

	</div>


	<!-- 合同详情弹框 -->
	<div id="TM-layui-hetong" style="display: none;">
		<div class="TM-he-tong admin-entering">
			<form class="layui-form TM-entering-form" action="" id="hetongform"
				novalidate="novalidate">
				<div class="form-left">
					<div class="layui-form-item">
						<label class="layui-form-label">企业名称 : </label>
						<div class="layui-input-block htqyname"></div>
						<input type="hidden" name="cusid" id="qyid">
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label"><span>服务费用 : </span></label>
						<div class="layui-input-block">
							<input type="text" name="servicecharge" id="servicecharge"
								readonly="readonly" autocomplete="off" class="layui-input htlayui-disabled">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label"><i>*</i><span>签订时间
								:</span> </label>
						<div class="layui-input-block">
							<input type="text" name="signingtime" id="signingtime"
								readonly="readonly" placeholder="yyyy-mm-dd" autocomplete="off"
								class="layui-input" onclick="layui.laydate({elem: this})">
						</div>
					</div>
				</div>
				<div class="form-right">
					<div class="layui-form-item">
						<label class="layui-form-label"><i>*</i><span>合同金额
								: </span></label>
						<div class="layui-input-block">
							<input type="text" name="totalamount" id="totalamount"
								readonly="readonly" autocomplete="off" class="layui-input htlayui-disabled">
						</div>
					</div>
					<div class="layui-form-item warehouse">
						<label class="layui-form-label"><i>*</i><span>合同类型:
						</span></label>
						<div class="layui-input-block">
							<select name="contracttype" lay-filter="contracttype">
								<dic:cf type="2" name="contract_type" value="" />
							</select>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label"><i>*</i><span>签订年限
								: </span></label>
						<div class="layui-input-block">
							<select name="lifetype" lay-filter="lifetype">
								<dic:cf type="2" name="life_type" value="1" />
							</select>
						</div>
					</div>
				</div>
				<div class="layui-form-item TM-hetong-jilu">
					<label class="layui-form-label">合同备注 : </label>
					<div class="layui-input-block">
						<textarea placeholder="请输入内容" name="remark" class="layui-textarea"></textarea>
					</div>
				</div>
				<div class="entering" id="sxzs" style="width: 95%">
					<h4>
						<font id="rytitle">猎证</font>&nbsp;&nbsp;
						<button
							class="layui-btn layui-btn-primary layui-btn-small addlxr zhengshu"
							type="button">+添加人员</button>
					</h4>
					<table class="site-table table-hover TM-table3"
						style="border: 1px solid #FFFFFF">
						<thead>
							<tr>
								<th style="width: 8%;">客户名称</th>
								<th style="width: 35%;" id="rzjgtitle">人才证书价格</th>
								<th style="width: 25%;"  id="qyjgtitle">企业证书价格</th>
								<th style="width: 17%;" id="zssl">备注</th>
								<th style="width: 8%;">所属人</th>
								<th style="width: 8%;">操作</th>
							</tr>
						</thead>
						<tbody class="tb_zs">

						</tbody>
					</table>

				</div>
			</form>
		</div>
	</div>

	<!-- 添加证书弹框 -->
	<div id="TM-layui-zhengshu" style="display: none;">
		<div class="tab-condition" style="margin-left: 35px;">
			<form class="layui-form clefix" action="" id="zssearch">
				<div class="layui-form-item">
					<div class="layui-input-block">
						<input type="text" name="keyWord" id="zskeyword"
							autocomplete="off" placeholder="请输入关键字" class="layui-input">
						<input type="hidden" id="skpg" name="skipToPage" value="1">

					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-block">
						<select name="state" class="" lay-filter="state">
							<option value="-1" selected="">成熟等级</option>
							<option value="0"
								<c:if test="${cuinfo.state==0 || state == 0}">selected</c:if>>最新资源</option>
							<option value="1"
								<c:if test="${cuinfo.state==1 || state == 1}">selected</c:if>>意向不明</option>
							<option value="2"
								<c:if test="${cuinfo.state==2 || state == 2}">selected</c:if>>意向明确</option>
							<option value="3"
								<c:if test="${cuinfo.state==3 || state == 3}">selected</c:if>>意向强烈</option>
							<option value="7"
								<c:if test="${cuinfo.state==7 || state == 7}">selected</c:if>>合作客户</option>
						</select>
					</div>
				</div>
				<div class="layui-form-item">
					<button class="layui-btn TM-btn-search zssearchbtn" type="button">
						<i class="layui-icon layui-unselect layui-tab-close">&#xe615;</i>搜索
					</button>
					<button class="layui-btn TM-btn-search zscleanbtn" type="button">
						<i class="layui-icon layui-unselect layui-tab-close">&#xe615;</i>清空
					</button>
				</div>
			</form>
		</div>
		<div class="entering">
			<table class="site-table table-hover TM-table3"
				style="width: 90%; margin: 0 auto;">
				<thead>
					<tr>
						<th style="width: 102px;">是否垫款</th>
						<th style="width: 122px;">客户名称</th>
						<th style="width: 100px;">垫款总额</th>
						<th style="width: 172px;">身份证号</th>
						<th style="width: 172px;">所属人</th>
						<th style="width: 171px;">所在库</th>
						<th style="width: 101px;">操作</th>
					</tr>
				</thead>
				<tbody class="tb_customerzs">
				</tbody>
			</table>
			<div class="admin-table-page">
				<div id="zspage" class="page"></div>
			</div>
		</div>
	</div>
	
	<!-- 资源导入弹窗 -->
	<div id="insertdiv" style="display: none;">
		<form id="insertform" action="/systerm/uploadexcel" method="post"
			enctype="multipart/form-data">
			<div style="margin-top: 20px; font-size: 18px; text-align: center;">
				<div>
					<blockquote class="layui-elem-quote"><a href="<%=basePath%>upload/enterprise.xlsx"><b>点击下载</b></a>模版，填写完成后点击上传。</blockquote>
				</div>
				<div style="margin-top: 10px;">
					<input type="file" id="file" name="file" style="border: 1px solid #e6e6e6; height: 31px;"> 
					<input type="hidden" id="filetype" name="type" value="${customertype}">
					<input type="hidden" id="filestate" name="state" value="${customerstate}">
				</div>
			</div>
		</form>
	</div>
<!-- 发布需求弹窗 -->
	<div class="addxqtc" style="display:none;">
   		<form action="" id="tc_savecustomercategoryform"  class="layui-form" >
   			<div class="tc_customercategorydiv"style="padding-top:10px;">
	   			<div class="layui-form-item">
	   				<label class="layui-form-label"><i>*</i><span>证书需求 : </span></label>
	   				<div class="layui-input-inline" style="width:80%">
	            		<input name="category" id="category" type="hidden" value="" >
	                  	<input type="text" name="zizhiType" id="zizhiType" class="layui-input" placeholder="请选择需求证书">
	                </div>
	   			</div>
	   			<div class="layui-form-item categoryselect">
	   				<label class="layui-form-label"><i>*</i><span>数量 : </span></label>
	                   <div class="layui-input-inline" style="width:80%">
							<input name="count" id="count" type="text" value=""  class="layui-input" placeholder="请输入证书所需数量">
	                   </div>
	   			</div>
	   			<!-- <div class="layui-form-item categoryselect">
	   				<label class="layui-form-label"><i>*</i><span>结束时间 : </span></label>
	                   <div class="layui-input-inline" style="width:80%">
							<input type="text" name="endtime" id="endtime"  class="layui-input" placeholder="请选择结束时间:yyyy-mm-dd" autocomplete="off"  onclick="layui.laydate({elem: this})">
	                   </div>
	   			</div> -->
	   			<div class="layui-form-item categoryselect">
	   				<label class="layui-form-label"><i>*</i><span>性质 : </span></label>
					<div class="layui-input-inline" style="width:80%">
						<select name="types" id="types" class="layui-input layui-unselect">
							<option value="1">初始</option>
							<option value="2">转注</option>
							<option value="3">初转不限</option>
							<option value="4">资质</option>
                       </select>
					</div>
	   			</div>
	   			<div class="layui-form-item categoryselect">
	   				<label class="layui-form-label"><i>*</i><span>用途 : </span></label>
                   <div class="layui-input-inline" style="width:80%">
                       <select name="paperspurpose" id="paperspurpose" class="layui-input layui-unselect">
                           <option value="1">入库</option>
                           <option value="2">项目</option>
                       </select>
                   </div>
	   			</div>
	   			<div class="layui-form-item categoryselect">
	   				<label class="layui-form-label">备注 : </label>
	   				<div class="layui-input-inline" style="width:80%">
	   					<textarea placeholder="请输入备注内容" name="remark" id="xqremark" class="layui-textarea"></textarea>
						<input type="hidden" id="cusid" name="cusid" value="${customerid}">
					</div>
	   			</div>
	   			<div class="layui-form-item tc_btndiv">
	   				<input type="hidden" value="" id="categoryid" name="id">
	            </div>
            </div>
   		</form>
    </div>


	<script id="zslb" type="text/html"> 
{{#  layui.each(d.resultList, function(index, item){ }} 
<tr  >
					<td>{{# if(item.advancemoney>0){ }}<span style="color:red;">已垫款</span> {{#  } else { }} 未垫款 {{#  } }} </td>
		                <td>{{item.cname}}</td>
						<td>{{item.advancemoney}}</td>
						<td>{{item.idcard}}</td>
		                <td>{{item.createusersname}}</td>
		              	<td>{{# if(item.state==1){ }} 意向不明 {{#  } }} {{#  if(item.state==7){ }} 合作客户 {{#  } }}{{#  if(item.state==2){ }} 意向明确{{#  } }}{{#  if(item.state==3){ }} 意向强烈{{#  } }}{{#  if(item.state==0){ }} 最新资源{{#  } }}</td>
		                <td>
                           <button class="layui-btn layui-btn-primary layui-btn-small addzs" data="{'id':'{{item.id}}','uid':'{{item.uid}}','name':'{{item.cname}}','createname':'{{item.createusersname}}','advancemoney':'{{item.advancemoney}}'}"   type="button">添加<i class="layui-icon"></i></button>
		                </td>
	               	</tr>
 
{{#  }); }}  
</script>


	<script id="zs" type="text/html"> 
					<tr class="zs{{d.id}}" data="{{d.id}}">
		                <td  >{{d.name}}</td>
		                <td><input type="text" value="" name="totalms"  style="width:60px;height:25px;">&nbsp;<label>/元</label>  <span id="othermy{{d.id}}"  style="display:none">&nbsp;&nbsp;&nbsp;&nbsp;<label>其它费用:</label><input type="text" value="0" name="otmoney"  style="width:60px;height:25px;">&nbsp;<label>/元</label><span>   <input type="hidden"   name="uids" value="{{d.uid}}"  > <input type="hidden"   name="cids" value="{{d.id}}"  ><input type="hidden"   name="advancemoney" value="{{d.advancemoney}}"  ></td>
		                <td><input type="text" value="" name="alonems"  style="width:60px;height:25px;">&nbsp;<label>/元</label></td>
						<td><input type="text" value="" name="zsremark"  style="width:100%;height:25px;"></td>
						<td>{{d.createname}}</td>
		                <td>
							<div class="layui-btn-group">
								<button class="layui-btn layui-btn-primary layui-btn-small addothermoney"  data="{{d.id}}" type="button">  <i class="layui-icon">&#xe654;</i>  </button>
								<button class="layui-btn layui-btn-primary layui-btn-small deletezs" data="{{d.id}}" type="button">  <i class="layui-icon">&#xe640;</i>  </button>
                            </div>
		                </td>
	               	</tr>	
	</script>
	<script type="text/javascript" src="<%=basePath%>js/customerlist.js?v=<%=callcenterstate%>28"></script>
	<script type="text/javascript" src="<%=basePath%>js/monitor.js"></script>
	<script type="text/javascript">
		
	</script>
</body>
</html>